<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/11/30
 * Time: 11:22
 */

function getMethodParams($method, $class = null)
{
    $param_names = [];
    if ($class) {
        $reflector = new ReflectionMethod($class, $method);
    } else {
        $reflector = new ReflectionFunction($method);
    }
    foreach ($reflector->getParameters() as $p) {
        $param_names[] = $p->getName();
    }
    return $param_names;
}

$data = [
    'uid' => 'ffff',
    'id' => '12',
    'name' => 'zs',
    'a' => 1,
    'b' => 2
];
$pnames = getMethodParams('abcde');
$values = [];
foreach ($pnames as $p) {
    $values[] = $data[$p];
}

print_r($values);

function abcde($id,$a, $uid)
{

}

class TestClass
{
    public function foo($aa, $bb, $cc)
    {

    }
}
//print_r(getMethodParams('foo', 'TestClass'));
//print_r(getMethodParams('abcde'));
